package com.qingcloud.adminbackend.enums;


/**
 * 传感器状态：2正常，3运维中
 */
public enum DeviceMaintStatusEnum {

    NORMAL(2, "正常"),
    MAINT(3, "运维中");

    private int code;
    private String name;

    private DeviceMaintStatusEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return this.code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static DeviceMaintStatusEnum getEnumByCode(int code) {
        DeviceMaintStatusEnum[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            DeviceMaintStatusEnum cpt = var1[var3];
            if(code == cpt.getCode()) {
                return cpt;
            }
        }

        return null;
    }

    public static String getNameByCode(int code) {
        if(code != 0) {
            DeviceMaintStatusEnum[] var1 = values();
            int var2 = var1.length;

            for(int var3 = 0; var3 < var2; ++var3) {
                DeviceMaintStatusEnum v = var1[var3];
                if(code == v.getCode()) {
                    return v.getName();
                }
            }
        }
        return "";
    }
}
